package com.axin.common.utils;

import java.util.Random;

public class IDUtils {

	public static long randomId() {
		//取当前时间的长整形值包含毫秒
		long millis = System.currentTimeMillis();
		//long millis = System.nanoTime();
		//加上三位随机数
		Random random = new Random();
		int end2 = random.nextInt(999);
		//如果不足两位前面补0
		String str = millis + String.format("%03d", end2);
		long id = new Long(str);
		return id;
	}
	
	public static void main(String[] args) {
		for(int i=0;i< 100;i++)
		System.out.println(randomId());
	}
}
